package com.li.action;

import com.li.dao.StudentDao;
import com.li.hibenate.pojo.Student;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class RegAction extends ActionSupport implements ModelDriven{
	
	private Student student = new Student();
	
	public String execute(){
		
	 if(student.getSname()==null||student.getSpwd()==null||"".equals(student.getSname())||"".equals(student.getSpwd())){
			return "error";
				}
		StudentDao dao = new StudentDao();
		
		if(dao.save(student)){
			return "login";
		}else{
			return "error";
		}
	}

	public Student getStudent() {
		return student;
	}

	public void setStudent(Student student) {
		this.student = student;
	}
	public Student getModel() {
		// TODO Auto-generated method stub
		return student;
	}
}
